1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gobject.Signals;
26 
27 private import glib.Str;
28 private import glib.c.functions;
29 private import gobject.Closure;
30 private import gobject.DClosure;
31 private import gobject.ObjectG;
32 private import gobject.TypeInstance;
33 private import gobject.Value;
34 private import gobject.c.functions;
35 public  import gobject.c.types;
36 private import std.traits;
37 
38 
39 /** */
40 public struct Signals
41 {
42 	/**
43 	 * Connects a callback to a signal for a particular object.
44 	 *
45 	 * The handler will be called before the default handler of the signal.
46 	 *
47 	 * Params:
48 	 *     instance       = the instance to connect to.
49 	 *     detailedSignal = a string of the form "signal-name::detail".
50 	 *     callback       = the callback to connect.
51 	 *     connectFlags   = a combination of ConnectFlags.
52 	 *
53 	 * Returns: the handler ID, of type gulong (always greater than 0 for successful connections)
54 	 */
55 	public static gulong connect(T)(ObjectG instance, string detailedSignal, T callback, ConnectFlags connectFlags = cast(ConnectFlags)0)
56 	if ( isCallable!T && !is(T == GCallback) )
57 	{
58 		bool after = (connectFlags & ConnectFlags.AFTER) != false;
59 		bool swap = (connectFlags & ConnectFlags.SWAPPED) != false;
60 
61 		DClosure closure = new DClosure(callback, swap);
62 		gulong id = Signals.connectClosure(instance, detailedSignal, closure, after);
63 
64 		instance.signals[id] = closure;
65 		return id;
66 	}
67 
68 	deprecated public static gulong connectData(void* instanc, string detailedSignal, GCallback cHandler, Object data, GClosureNotify destroyData, GConnectFlags connectFlags)
69 	{
70 		return g_signal_connect_data(instanc, Str.toStringz(detailedSignal), cHandler, cast(void*)data, destroyData, connectFlags);
71 	}
72 
73 	/**
74 	 * Disconnects a handler from an instance so it will not be called during
75 	 * any future or currently ongoing emissions of the signal it has been
76 	 * connected to. The @handler_id becomes invalid and may be reused.
77 	 *
78 	 * The @handler_id has to be a valid signal handler id, connected to a
79 	 * signal of @instance.
80 	 *
81 	 * Params:
82 	 *     instance = The instance to remove the signal handler from.
83 	 *     handlerId = Handler id of the handler to be disconnected.
84 	 */
85 	public static void handlerDisconnect(ObjectG instance, gulong handlerId)
86 	{
87 		instance.signals.remove(handlerId);
88 		g_signal_handler_disconnect((instance is null) ? null : instance.getObjectGStruct(), handlerId);
89 	}
90 
91 	/**
92 	 * Connects a GCallback function to a signal for a particular object.
93 	 *
94 	 * The handler will be called before the default handler of the signal.
95 	 *
96 	 * See [memory management of signal handlers][signal-memory-management] for
97 	 * details on how to handle the return value and memory management of @data.
98 	 *
99 	 * Params:
100 	 *     instance       = the instance to connect to.
101 	 *     detailedSignal = a string of the form "signal-name::detail".
102 	 *     cHandler       = the GCallback to connect.
103 	 *     data           = data to pass to cHandler calls.
104 	 *
105 	 * Returns: the handler ID, of type gulong (always greater than 0 for successful connections)
106 	 */
107 	public static gulong connect(ObjectG instanc, string detailedSignal, GCallback cHandler, void* data)
108 	{
109 		return g_signal_connect_data((instanc is null) ? null : instanc.getObjectGStruct(), Str.toStringz(detailedSignal), cHandler, data, null, cast(ConnectFlags)0);
110 	}
111 
112 	/**
113 	 */
114 
115 	/**
116 	 * A predefined #GSignalAccumulator for signals intended to be used as a
117 	 * hook for application code to provide a particular value.  Usually
118 	 * only one such value is desired and multiple handlers for the same
119 	 * signal don't make much sense (except for the case of the default
120 	 * handler defined in the class structure, in which case you will
121 	 * usually want the signal connection to override the class handler).
122 	 *
123 	 * This accumulator will use the return value from the first signal
124 	 * handler that is run as the return value for the signal and not run
125 	 * any further handlers (ie: the first handler "wins").
126 	 *
127 	 * Params:
128 	 *     ihint = standard #GSignalAccumulator parameter
129 	 *     returnAccu = standard #GSignalAccumulator parameter
130 	 *     handlerReturn = standard #GSignalAccumulator parameter
131 	 *     dummy = standard #GSignalAccumulator parameter
132 	 *
133 	 * Returns: standard #GSignalAccumulator result
134 	 *
135 	 * Since: 2.28
136 	 */
137 	public static bool accumulatorFirstWins(GSignalInvocationHint* ihint, Value returnAccu, Value handlerReturn, void* dummy)
138 	{
139 		return g_signal_accumulator_first_wins(ihint, (returnAccu is null) ? null : returnAccu.getValueStruct(), (handlerReturn is null) ? null : handlerReturn.getValueStruct(), dummy) != 0;
140 	}
141 
142 	/**
143 	 * A predefined #GSignalAccumulator for signals that return a
144 	 * boolean values. The behavior that this accumulator gives is
145 	 * that a return of %TRUE stops the signal emission: no further
146 	 * callbacks will be invoked, while a return of %FALSE allows
147 	 * the emission to continue. The idea here is that a %TRUE return
148 	 * indicates that the callback handled the signal, and no further
149 	 * handling is needed.
150 	 *
151 	 * Params:
152 	 *     ihint = standard #GSignalAccumulator parameter
153 	 *     returnAccu = standard #GSignalAccumulator parameter
154 	 *     handlerReturn = standard #GSignalAccumulator parameter
155 	 *     dummy = standard #GSignalAccumulator parameter
156 	 *
157 	 * Returns: standard #GSignalAccumulator result
158 	 *
159 	 * Since: 2.4
160 	 */
161 	public static bool accumulatorTrueHandled(GSignalInvocationHint* ihint, Value returnAccu, Value handlerReturn, void* dummy)
162 	{
163 		return g_signal_accumulator_true_handled(ihint, (returnAccu is null) ? null : returnAccu.getValueStruct(), (handlerReturn is null) ? null : handlerReturn.getValueStruct(), dummy) != 0;
164 	}
165 
166 	/**
167 	 * Adds an emission hook for a signal, which will get called for any emission
168 	 * of that signal, independent of the instance. This is possible only
169 	 * for signals which don't have %G_SIGNAL_NO_HOOKS flag set.
170 	 *
171 	 * Params:
172 	 *     signalId = the signal identifier, as returned by g_signal_lookup().
173 	 *     detail = the detail on which to call the hook.
174 	 *     hookFunc = a #GSignalEmissionHook function.
175 	 *     hookData = user data for @hook_func.
176 	 *     dataDestroy = a #GDestroyNotify for @hook_data.
177 	 *
178 	 * Returns: the hook id, for later use with g_signal_remove_emission_hook().
179 	 */
180 	public static gulong addEmissionHook(uint signalId, GQuark detail, GSignalEmissionHook hookFunc, void* hookData, GDestroyNotify dataDestroy)
181 	{
182 		return g_signal_add_emission_hook(signalId, detail, hookFunc, hookData, dataDestroy);
183 	}
184 
185 	/**
186 	 * Calls the original class closure of a signal. This function should only
187 	 * be called from an overridden class closure; see
188 	 * g_signal_override_class_closure() and
189 	 * g_signal_override_class_handler().
190 	 *
191 	 * Params:
192 	 *     instanceAndParams = the argument list of the signal emission.
193 	 *         The first element in the array is a #GValue for the instance the signal
194 	 *         is being emitted on. The rest are any arguments to be passed to the signal.
195 	 *     returnValue = Location for the return value.
196 	 */
197 	public static void chainFromOverridden(Value[] instanceAndParams, Value returnValue)
198 	{
199 		GValue[] instanceAndParamsArray = new GValue[instanceAndParams.length];
200 		for ( int i = 0; i < instanceAndParams.length; i++ )
201 		{
202 			instanceAndParamsArray[i] = *(instanceAndParams[i].getValueStruct());
203 		}
204 
205 		g_signal_chain_from_overridden(instanceAndParamsArray.ptr, (returnValue is null) ? null : returnValue.getValueStruct());
206 	}
207 
208 	/**
209 	 * Connects a closure to a signal for a particular object.
210 	 *
211 	 * Params:
212 	 *     instance_ = the instance to connect to.
213 	 *     detailedSignal = a string of the form "signal-name::detail".
214 	 *     closure = the closure to connect.
215 	 *     after = whether the handler should be called before or after the
216 	 *         default handler of the signal.
217 	 *
218 	 * Returns: the handler ID (always greater than 0 for successful connections)
219 	 */
220 	public static gulong connectClosure(ObjectG instance_, string detailedSignal, Closure closure, bool after)
221 	{
222 		return g_signal_connect_closure((instance_ is null) ? null : instance_.getObjectGStruct(), Str.toStringz(detailedSignal), (closure is null) ? null : closure.getClosureStruct(), after);
223 	}
224 
225 	/**
226 	 * Connects a closure to a signal for a particular object.
227 	 *
228 	 * Params:
229 	 *     instance_ = the instance to connect to.
230 	 *     signalId = the id of the signal.
231 	 *     detail = the detail.
232 	 *     closure = the closure to connect.
233 	 *     after = whether the handler should be called before or after the
234 	 *         default handler of the signal.
235 	 *
236 	 * Returns: the handler ID (always greater than 0 for successful connections)
237 	 */
238 	public static gulong connectClosureById(ObjectG instance_, uint signalId, GQuark detail, Closure closure, bool after)
239 	{
240 		return g_signal_connect_closure_by_id((instance_ is null) ? null : instance_.getObjectGStruct(), signalId, detail, (closure is null) ? null : closure.getClosureStruct(), after);
241 	}
242 
243 	/**
244 	 * Connects a #GCallback function to a signal for a particular object. Similar
245 	 * to g_signal_connect(), but allows to provide a #GClosureNotify for the data
246 	 * which will be called when the signal handler is disconnected and no longer
247 	 * used. Specify @connect_flags if you need `..._after()` or
248 	 * `..._swapped()` variants of this function.
249 	 *
250 	 * Params:
251 	 *     instance_ = the instance to connect to.
252 	 *     detailedSignal = a string of the form "signal-name::detail".
253 	 *     cHandler = the #GCallback to connect.
254 	 *     data = data to pass to @c_handler calls.
255 	 *     destroyData = a #GClosureNotify for @data.
256 	 *     connectFlags = a combination of #GConnectFlags.
257 	 *
258 	 * Returns: the handler ID (always greater than 0 for successful connections)
259 	 */
260 	public static gulong connectData(ObjectG instance_, string detailedSignal, GCallback cHandler, void* data, GClosureNotify destroyData, GConnectFlags connectFlags)
261 	{
262 		return g_signal_connect_data((instance_ is null) ? null : instance_.getObjectGStruct(), Str.toStringz(detailedSignal), cHandler, data, destroyData, connectFlags);
263 	}
264 
265 	/**
266 	 * This is similar to g_signal_connect_data(), but uses a closure which
267 	 * ensures that the @gobject stays alive during the call to @c_handler
268 	 * by temporarily adding a reference count to @gobject.
269 	 *
270 	 * When the @gobject is destroyed the signal handler will be automatically
271 	 * disconnected.  Note that this is not currently threadsafe (ie:
272 	 * emitting a signal while @gobject is being destroyed in another thread
273 	 * is not safe).
274 	 *
275 	 * Params:
276 	 *     instance_ = the instance to connect to.
277 	 *     detailedSignal = a string of the form "signal-name::detail".
278 	 *     cHandler = the #GCallback to connect.
279 	 *     gobject = the object to pass as data
280 	 *         to @c_handler.
281 	 *     connectFlags = a combination of #GConnectFlags.
282 	 *
283 	 * Returns: the handler id.
284 	 */
285 	public static gulong connectObject(TypeInstance instance_, string detailedSignal, GCallback cHandler, ObjectG gobject, GConnectFlags connectFlags)
286 	{
287 		return g_signal_connect_object((instance_ is null) ? null : instance_.getTypeInstanceStruct(), Str.toStringz(detailedSignal), cHandler, (gobject is null) ? null : gobject.getObjectGStruct(), connectFlags);
288 	}
289 
290 	/**
291 	 * Emits a signal. Signal emission is done synchronously.
292 	 * The method will only return control after all handlers are called or signal emission was stopped.
293 	 *
294 	 * Note that g_signal_emit_valist() resets the return value to the default
295 	 * if no handlers are connected, in contrast to g_signal_emitv().
296 	 *
297 	 * Params:
298 	 *     instance_ = the instance the signal is being
299 	 *         emitted on.
300 	 *     signalId = the signal id
301 	 *     detail = the detail
302 	 *     varArgs = a list of parameters to be passed to the signal, followed by a
303 	 *         location for the return value. If the return type of the signal
304 	 *         is %G_TYPE_NONE, the return value location can be omitted.
305 	 */
306 	public static void emitValist(TypeInstance instance_, uint signalId, GQuark detail, void* varArgs)
307 	{
308 		g_signal_emit_valist((instance_ is null) ? null : instance_.getTypeInstanceStruct(), signalId, detail, varArgs);
309 	}
310 
311 	/**
312 	 * Emits a signal. Signal emission is done synchronously.
313 	 * The method will only return control after all handlers are called or signal emission was stopped.
314 	 *
315 	 * Note that g_signal_emitv() doesn't change @return_value if no handlers are
316 	 * connected, in contrast to g_signal_emit() and g_signal_emit_valist().
317 	 *
318 	 * Params:
319 	 *     instanceAndParams = argument list for the signal emission.
320 	 *         The first element in the array is a #GValue for the instance the signal
321 	 *         is being emitted on. The rest are any arguments to be passed to the signal.
322 	 *     signalId = the signal id
323 	 *     detail = the detail
324 	 *     returnValue = Location to
325 	 *         store the return value of the signal emission. This must be provided if the
326 	 *         specified signal returns a value, but may be ignored otherwise.
327 	 */
328 	public static void emitv(Value[] instanceAndParams, uint signalId, GQuark detail, ref Value returnValue)
329 	{
330 		GValue[] instanceAndParamsArray = new GValue[instanceAndParams.length];
331 		for ( int i = 0; i < instanceAndParams.length; i++ )
332 		{
333 			instanceAndParamsArray[i] = *(instanceAndParams[i].getValueStruct());
334 		}
335 
336 		g_signal_emitv(instanceAndParamsArray.ptr, signalId, detail, (returnValue is null) ? null : returnValue.getValueStruct());
337 	}
338 
339 	/**
340 	 * Returns the invocation hint of the innermost signal emission of instance.
341 	 *
342 	 * Params:
343 	 *     instance_ = the instance to query
344 	 *
345 	 * Returns: the invocation hint of the innermost
346 	 *     signal emission, or %NULL if not found.
347 	 */
348 	public static GSignalInvocationHint* getInvocationHint(ObjectG instance_)
349 	{
350 		return g_signal_get_invocation_hint((instance_ is null) ? null : instance_.getObjectGStruct());
351 	}
352 
353 	/**
354 	 * Blocks a handler of an instance so it will not be called during any
355 	 * signal emissions unless it is unblocked again. Thus "blocking" a
356 	 * signal handler means to temporarily deactivate it, a signal handler
357 	 * has to be unblocked exactly the same amount of times it has been
358 	 * blocked before to become active again.
359 	 *
360 	 * The @handler_id has to be a valid signal handler id, connected to a
361 	 * signal of @instance.
362 	 *
363 	 * Params:
364 	 *     instance_ = The instance to block the signal handler of.
365 	 *     handlerId = Handler id of the handler to be blocked.
366 	 */
367 	public static void handlerBlock(ObjectG instance_, gulong handlerId)
368 	{
369 		g_signal_handler_block((instance_ is null) ? null : instance_.getObjectGStruct(), handlerId);
370 	}
371 
372 	/**
373 	 * Finds the first signal handler that matches certain selection criteria.
374 	 * The criteria mask is passed as an OR-ed combination of #GSignalMatchType
375 	 * flags, and the criteria values are passed as arguments.
376 	 * The match @mask has to be non-0 for successful matches.
377 	 * If no handler was found, 0 is returned.
378 	 *
379 	 * Params:
380 	 *     instance_ = The instance owning the signal handler to be found.
381 	 *     mask = Mask indicating which of @signal_id, @detail, @closure, @func
382 	 *         and/or @data the handler has to match.
383 	 *     signalId = Signal the handler has to be connected to.
384 	 *     detail = Signal detail the handler has to be connected to.
385 	 *     closure = The closure the handler will invoke.
386 	 *     func = The C closure callback of the handler (useless for non-C closures).
387 	 *     data = The closure data of the handler's closure.
388 	 *
389 	 * Returns: A valid non-0 signal handler id for a successful match.
390 	 */
391 	public static gulong handlerFind(ObjectG instance_, GSignalMatchType mask, uint signalId, GQuark detail, Closure closure, void* func, void* data)
392 	{
393 		return g_signal_handler_find((instance_ is null) ? null : instance_.getObjectGStruct(), mask, signalId, detail, (closure is null) ? null : closure.getClosureStruct(), func, data);
394 	}
395 
396 	/**
397 	 * Returns whether @handler_id is the ID of a handler connected to @instance.
398 	 *
399 	 * Params:
400 	 *     instance_ = The instance where a signal handler is sought.
401 	 *     handlerId = the handler ID.
402 	 *
403 	 * Returns: whether @handler_id identifies a handler connected to @instance.
404 	 */
405 	public static bool handlerIsConnected(ObjectG instance_, gulong handlerId)
406 	{
407 		return g_signal_handler_is_connected((instance_ is null) ? null : instance_.getObjectGStruct(), handlerId) != 0;
408 	}
409 
410 	/**
411 	 * Undoes the effect of a previous g_signal_handler_block() call.  A
412 	 * blocked handler is skipped during signal emissions and will not be
413 	 * invoked, unblocking it (for exactly the amount of times it has been
414 	 * blocked before) reverts its "blocked" state, so the handler will be
415 	 * recognized by the signal system and is called upon future or
416 	 * currently ongoing signal emissions (since the order in which
417 	 * handlers are called during signal emissions is deterministic,
418 	 * whether the unblocked handler in question is called as part of a
419 	 * currently ongoing emission depends on how far that emission has
420 	 * proceeded yet).
421 	 *
422 	 * The @handler_id has to be a valid id of a signal handler that is
423 	 * connected to a signal of @instance and is currently blocked.
424 	 *
425 	 * Params:
426 	 *     instance_ = The instance to unblock the signal handler of.
427 	 *     handlerId = Handler id of the handler to be unblocked.
428 	 */
429 	public static void handlerUnblock(ObjectG instance_, gulong handlerId)
430 	{
431 		g_signal_handler_unblock((instance_ is null) ? null : instance_.getObjectGStruct(), handlerId);
432 	}
433 
434 	/**
435 	 * Blocks all handlers on an instance that match a certain selection criteria.
436 	 * The criteria mask is passed as an OR-ed combination of #GSignalMatchType
437 	 * flags, and the criteria values are passed as arguments.
438 	 * Passing at least one of the %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC
439 	 * or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
440 	 * If no handlers were found, 0 is returned, the number of blocked handlers
441 	 * otherwise.
442 	 *
443 	 * Params:
444 	 *     instance_ = The instance to block handlers from.
445 	 *     mask = Mask indicating which of @signal_id, @detail, @closure, @func
446 	 *         and/or @data the handlers have to match.
447 	 *     signalId = Signal the handlers have to be connected to.
448 	 *     detail = Signal detail the handlers have to be connected to.
449 	 *     closure = The closure the handlers will invoke.
450 	 *     func = The C closure callback of the handlers (useless for non-C closures).
451 	 *     data = The closure data of the handlers' closures.
452 	 *
453 	 * Returns: The number of handlers that matched.
454 	 */
455 	public static uint handlersBlockMatched(ObjectG instance_, GSignalMatchType mask, uint signalId, GQuark detail, Closure closure, void* func, void* data)
456 	{
457 		return g_signal_handlers_block_matched((instance_ is null) ? null : instance_.getObjectGStruct(), mask, signalId, detail, (closure is null) ? null : closure.getClosureStruct(), func, data);
458 	}
459 
460 	/**
461 	 * Destroy all signal handlers of a type instance. This function is
462 	 * an implementation detail of the #GObject dispose implementation,
463 	 * and should not be used outside of the type system.
464 	 *
465 	 * Params:
466 	 *     instance_ = The instance whose signal handlers are destroyed
467 	 */
468 	public static void handlersDestroy(ObjectG instance_)
469 	{
470 		g_signal_handlers_destroy((instance_ is null) ? null : instance_.getObjectGStruct());
471 	}
472 
473 	/**
474 	 * Disconnects all handlers on an instance that match a certain
475 	 * selection criteria. The criteria mask is passed as an OR-ed
476 	 * combination of #GSignalMatchType flags, and the criteria values are
477 	 * passed as arguments.  Passing at least one of the
478 	 * %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC or
479 	 * %G_SIGNAL_MATCH_DATA match flags is required for successful
480 	 * matches.  If no handlers were found, 0 is returned, the number of
481 	 * disconnected handlers otherwise.
482 	 *
483 	 * Params:
484 	 *     instance_ = The instance to remove handlers from.
485 	 *     mask = Mask indicating which of @signal_id, @detail, @closure, @func
486 	 *         and/or @data the handlers have to match.
487 	 *     signalId = Signal the handlers have to be connected to.
488 	 *     detail = Signal detail the handlers have to be connected to.
489 	 *     closure = The closure the handlers will invoke.
490 	 *     func = The C closure callback of the handlers (useless for non-C closures).
491 	 *     data = The closure data of the handlers' closures.
492 	 *
493 	 * Returns: The number of handlers that matched.
494 	 */
495 	public static uint handlersDisconnectMatched(ObjectG instance_, GSignalMatchType mask, uint signalId, GQuark detail, Closure closure, void* func, void* data)
496 	{
497 		return g_signal_handlers_disconnect_matched((instance_ is null) ? null : instance_.getObjectGStruct(), mask, signalId, detail, (closure is null) ? null : closure.getClosureStruct(), func, data);
498 	}
499 
500 	/**
501 	 * Unblocks all handlers on an instance that match a certain selection
502 	 * criteria. The criteria mask is passed as an OR-ed combination of
503 	 * #GSignalMatchType flags, and the criteria values are passed as arguments.
504 	 * Passing at least one of the %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC
505 	 * or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
506 	 * If no handlers were found, 0 is returned, the number of unblocked handlers
507 	 * otherwise. The match criteria should not apply to any handlers that are
508 	 * not currently blocked.
509 	 *
510 	 * Params:
511 	 *     instance_ = The instance to unblock handlers from.
512 	 *     mask = Mask indicating which of @signal_id, @detail, @closure, @func
513 	 *         and/or @data the handlers have to match.
514 	 *     signalId = Signal the handlers have to be connected to.
515 	 *     detail = Signal detail the handlers have to be connected to.
516 	 *     closure = The closure the handlers will invoke.
517 	 *     func = The C closure callback of the handlers (useless for non-C closures).
518 	 *     data = The closure data of the handlers' closures.
519 	 *
520 	 * Returns: The number of handlers that matched.
521 	 */
522 	public static uint handlersUnblockMatched(ObjectG instance_, GSignalMatchType mask, uint signalId, GQuark detail, Closure closure, void* func, void* data)
523 	{
524 		return g_signal_handlers_unblock_matched((instance_ is null) ? null : instance_.getObjectGStruct(), mask, signalId, detail, (closure is null) ? null : closure.getClosureStruct(), func, data);
525 	}
526 
527 	/**
528 	 * Returns whether there are any handlers connected to @instance for the
529 	 * given signal id and detail.
530 	 *
531 	 * If @detail is 0 then it will only match handlers that were connected
532 	 * without detail.  If @detail is non-zero then it will match handlers
533 	 * connected both without detail and with the given detail.  This is
534 	 * consistent with how a signal emitted with @detail would be delivered
535 	 * to those handlers.
536 	 *
537 	 * Since 2.46 this also checks for a non-default class closure being
538 	 * installed, as this is basically always what you want.
539 	 *
540 	 * One example of when you might use this is when the arguments to the
541 	 * signal are difficult to compute. A class implementor may opt to not
542 	 * emit the signal if no one is attached anyway, thus saving the cost
543 	 * of building the arguments.
544 	 *
545 	 * Params:
546 	 *     instance_ = the object whose signal handlers are sought.
547 	 *     signalId = the signal id.
548 	 *     detail = the detail.
549 	 *     mayBeBlocked = whether blocked handlers should count as match.
550 	 *
551 	 * Returns: %TRUE if a handler is connected to the signal, %FALSE
552 	 *     otherwise.
553 	 */
554 	public static bool hasHandlerPending(ObjectG instance_, uint signalId, GQuark detail, bool mayBeBlocked)
555 	{
556 		return g_signal_has_handler_pending((instance_ is null) ? null : instance_.getObjectGStruct(), signalId, detail, mayBeBlocked) != 0;
557 	}
558 
559 	/**
560 	 * Lists the signals by id that a certain instance or interface type
561 	 * created. Further information about the signals can be acquired through
562 	 * g_signal_query().
563 	 *
564 	 * Params:
565 	 *     itype = Instance or interface type.
566 	 *
567 	 * Returns: Newly allocated array of signal IDs.
568 	 */
569 	public static uint[] listIds(GType itype)
570 	{
571 		uint nIds;
572 
573 		auto __p = g_signal_list_ids(itype, &nIds);
574 
575 		return __p[0 .. nIds];
576 	}
577 
578 	/**
579 	 * Given the name of the signal and the type of object it connects to, gets
580 	 * the signal's identifying integer. Emitting the signal by number is
581 	 * somewhat faster than using the name each time.
582 	 *
583 	 * Also tries the ancestors of the given type.
584 	 *
585 	 * The type class passed as @itype must already have been instantiated (for
586 	 * example, using g_type_class_ref()) for this function to work, as signals are
587 	 * always installed during class initialization.
588 	 *
589 	 * See g_signal_new() for details on allowed signal names.
590 	 *
591 	 * Params:
592 	 *     name = the signal's name.
593 	 *     itype = the type that the signal operates on.
594 	 *
595 	 * Returns: the signal's identifying number, or 0 if no signal was found.
596 	 */
597 	public static uint lookup(string name, GType itype)
598 	{
599 		return g_signal_lookup(Str.toStringz(name), itype);
600 	}
601 
602 	/**
603 	 * Given the signal's identifier, finds its name.
604 	 *
605 	 * Two different signals may have the same name, if they have differing types.
606 	 *
607 	 * Params:
608 	 *     signalId = the signal's identifying number.
609 	 *
610 	 * Returns: the signal name, or %NULL if the signal number was invalid.
611 	 */
612 	public static string name(uint signalId)
613 	{
614 		return Str.toString(g_signal_name(signalId));
615 	}
616 
617 	/**
618 	 * Creates a new signal. (This is usually done in the class initializer.)
619 	 *
620 	 * See g_signal_new() for details on allowed signal names.
621 	 *
622 	 * If c_marshaller is %NULL, g_cclosure_marshal_generic() will be used as
623 	 * the marshaller for this signal.
624 	 *
625 	 * Params:
626 	 *     signalName = the name for the signal
627 	 *     itype = the type this signal pertains to. It will also pertain to
628 	 *         types which are derived from this type.
629 	 *     signalFlags = a combination of #GSignalFlags specifying detail of when
630 	 *         the default handler is to be invoked. You should at least specify
631 	 *         %G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST.
632 	 *     classClosure = The closure to invoke on signal emission; may be %NULL.
633 	 *     accumulator = the accumulator for this signal; may be %NULL.
634 	 *     accuData = user data for the @accumulator.
635 	 *     cMarshaller = the function to translate arrays of parameter
636 	 *         values to signal emissions into C language callback invocations or %NULL.
637 	 *     returnType = the type of return value, or %G_TYPE_NONE for a signal
638 	 *         without a return value.
639 	 *     nParams = the number of parameter types in @args.
640 	 *     args = va_list of #GType, one for each parameter.
641 	 *
642 	 * Returns: the signal id
643 	 */
644 	public static uint newValist(string signalName, GType itype, GSignalFlags signalFlags, Closure classClosure, GSignalAccumulator accumulator, void* accuData, GSignalCMarshaller cMarshaller, GType returnType, uint nParams, void* args)
645 	{
646 		return g_signal_new_valist(Str.toStringz(signalName), itype, signalFlags, (classClosure is null) ? null : classClosure.getClosureStruct(), accumulator, accuData, cMarshaller, returnType, nParams, args);
647 	}
648 
649 	/**
650 	 * Creates a new signal. (This is usually done in the class initializer.)
651 	 *
652 	 * See g_signal_new() for details on allowed signal names.
653 	 *
654 	 * If c_marshaller is %NULL, g_cclosure_marshal_generic() will be used as
655 	 * the marshaller for this signal.
656 	 *
657 	 * Params:
658 	 *     signalName = the name for the signal
659 	 *     itype = the type this signal pertains to. It will also pertain to
660 	 *         types which are derived from this type
661 	 *     signalFlags = a combination of #GSignalFlags specifying detail of when
662 	 *         the default handler is to be invoked. You should at least specify
663 	 *         %G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST
664 	 *     classClosure = The closure to invoke on signal emission;
665 	 *         may be %NULL
666 	 *     accumulator = the accumulator for this signal; may be %NULL
667 	 *     accuData = user data for the @accumulator
668 	 *     cMarshaller = the function to translate arrays of
669 	 *         parameter values to signal emissions into C language callback
670 	 *         invocations or %NULL
671 	 *     returnType = the type of return value, or %G_TYPE_NONE for a signal
672 	 *         without a return value
673 	 *     paramTypes = an array of types, one for
674 	 *         each parameter (may be %NULL if @n_params is zero)
675 	 *
676 	 * Returns: the signal id
677 	 */
678 	public static uint newv(string signalName, GType itype, GSignalFlags signalFlags, Closure classClosure, GSignalAccumulator accumulator, void* accuData, GSignalCMarshaller cMarshaller, GType returnType, GType[] paramTypes)
679 	{
680 		return g_signal_newv(Str.toStringz(signalName), itype, signalFlags, (classClosure is null) ? null : classClosure.getClosureStruct(), accumulator, accuData, cMarshaller, returnType, cast(uint)paramTypes.length, paramTypes.ptr);
681 	}
682 
683 	/**
684 	 * Overrides the class closure (i.e. the default handler) for the given signal
685 	 * for emissions on instances of @instance_type. @instance_type must be derived
686 	 * from the type to which the signal belongs.
687 	 *
688 	 * See g_signal_chain_from_overridden() and
689 	 * g_signal_chain_from_overridden_handler() for how to chain up to the
690 	 * parent class closure from inside the overridden one.
691 	 *
692 	 * Params:
693 	 *     signalId = the signal id
694 	 *     instanceType = the instance type on which to override the class closure
695 	 *         for the signal.
696 	 *     classClosure = the closure.
697 	 */
698 	public static void overrideClassClosure(uint signalId, GType instanceType, Closure classClosure)
699 	{
700 		g_signal_override_class_closure(signalId, instanceType, (classClosure is null) ? null : classClosure.getClosureStruct());
701 	}
702 
703 	/**
704 	 * Overrides the class closure (i.e. the default handler) for the
705 	 * given signal for emissions on instances of @instance_type with
706 	 * callback @class_handler. @instance_type must be derived from the
707 	 * type to which the signal belongs.
708 	 *
709 	 * See g_signal_chain_from_overridden() and
710 	 * g_signal_chain_from_overridden_handler() for how to chain up to the
711 	 * parent class closure from inside the overridden one.
712 	 *
713 	 * Params:
714 	 *     signalName = the name for the signal
715 	 *     instanceType = the instance type on which to override the class handler
716 	 *         for the signal.
717 	 *     classHandler = the handler.
718 	 *
719 	 * Since: 2.18
720 	 */
721 	public static void overrideClassHandler(string signalName, GType instanceType, GCallback classHandler)
722 	{
723 		g_signal_override_class_handler(Str.toStringz(signalName), instanceType, classHandler);
724 	}
725 
726 	/**
727 	 * Internal function to parse a signal name into its @signal_id
728 	 * and @detail quark.
729 	 *
730 	 * Params:
731 	 *     detailedSignal = a string of the form "signal-name::detail".
732 	 *     itype = The interface/instance type that introduced "signal-name".
733 	 *     signalIdP = Location to store the signal id.
734 	 *     detailP = Location to store the detail quark.
735 	 *     forceDetailQuark = %TRUE forces creation of a #GQuark for the detail.
736 	 *
737 	 * Returns: Whether the signal name could successfully be parsed and @signal_id_p and @detail_p contain valid return values.
738 	 */
739 	public static bool parseName(string detailedSignal, GType itype, out uint signalIdP, out GQuark detailP, bool forceDetailQuark)
740 	{
741 		return g_signal_parse_name(Str.toStringz(detailedSignal), itype, &signalIdP, &detailP, forceDetailQuark) != 0;
742 	}
743 
744 	/**
745 	 * Queries the signal system for in-depth information about a
746 	 * specific signal. This function will fill in a user-provided
747 	 * structure to hold signal-specific information. If an invalid
748 	 * signal id is passed in, the @signal_id member of the #GSignalQuery
749 	 * is 0. All members filled into the #GSignalQuery structure should
750 	 * be considered constant and have to be left untouched.
751 	 *
752 	 * Params:
753 	 *     signalId = The signal id of the signal to query information for.
754 	 *     query = A user provided structure that is
755 	 *         filled in with constant values upon success.
756 	 */
757 	public static void query(uint signalId, out GSignalQuery query)
758 	{
759 		g_signal_query(signalId, &query);
760 	}
761 
762 	/**
763 	 * Deletes an emission hook.
764 	 *
765 	 * Params:
766 	 *     signalId = the id of the signal
767 	 *     hookId = the id of the emission hook, as returned by
768 	 *         g_signal_add_emission_hook()
769 	 */
770 	public static void removeEmission(uint signalId, gulong hookId)
771 	{
772 		g_signal_remove_emission_hook(signalId, hookId);
773 	}
774 
775 	/**
776 	 * Change the #GSignalCVaMarshaller used for a given signal.  This is a
777 	 * specialised form of the marshaller that can often be used for the
778 	 * common case of a single connected signal handler and avoids the
779 	 * overhead of #GValue.  Its use is optional.
780 	 *
781 	 * Params:
782 	 *     signalId = the signal id
783 	 *     instanceType = the instance type on which to set the marshaller.
784 	 *     vaMarshaller = the marshaller to set.
785 	 *
786 	 * Since: 2.32
787 	 */
788 	public static void setVaMarshaller(uint signalId, GType instanceType, GSignalCVaMarshaller vaMarshaller)
789 	{
790 		g_signal_set_va_marshaller(signalId, instanceType, vaMarshaller);
791 	}
792 
793 	/**
794 	 * Stops a signal's current emission.
795 	 *
796 	 * This will prevent the default method from running, if the signal was
797 	 * %G_SIGNAL_RUN_LAST and you connected normally (i.e. without the "after"
798 	 * flag).
799 	 *
800 	 * Prints a warning if used on a signal which isn't being emitted.
801 	 *
802 	 * Params:
803 	 *     instance_ = the object whose signal handlers you wish to stop.
804 	 *     signalId = the signal identifier, as returned by g_signal_lookup().
805 	 *     detail = the detail which the signal was emitted with.
806 	 */
807 	public static void stopEmission(ObjectG instance_, uint signalId, GQuark detail)
808 	{
809 		g_signal_stop_emission((instance_ is null) ? null : instance_.getObjectGStruct(), signalId, detail);
810 	}
811 
812 	/**
813 	 * Stops a signal's current emission.
814 	 *
815 	 * This is just like g_signal_stop_emission() except it will look up the
816 	 * signal id for you.
817 	 *
818 	 * Params:
819 	 *     instance_ = the object whose signal handlers you wish to stop.
820 	 *     detailedSignal = a string of the form "signal-name::detail".
821 	 */
822 	public static void stopEmissionByName(ObjectG instance_, string detailedSignal)
823 	{
824 		g_signal_stop_emission_by_name((instance_ is null) ? null : instance_.getObjectGStruct(), Str.toStringz(detailedSignal));
825 	}
826 
827 	/**
828 	 * Creates a new closure which invokes the function found at the offset
829 	 * @struct_offset in the class structure of the interface or classed type
830 	 * identified by @itype.
831 	 *
832 	 * Params:
833 	 *     itype = the #GType identifier of an interface or classed type
834 	 *     structOffset = the offset of the member function of @itype's class
835 	 *         structure which is to be invoked by the new closure
836 	 *
837 	 * Returns: a floating reference to a new #GCClosure
838 	 */
839 	public static Closure typeCclosureNew(GType itype, uint structOffset)
840 	{
841 		auto __p = g_signal_type_cclosure_new(itype, structOffset);
842 
843 		if(__p is null)
844 		{
845 			return null;
846 		}
847 
848 		return ObjectG.getDObject!(Closure)(cast(GClosure*) __p);
849 	}
850 
851 	/**
852 	 * Disconnects a handler from @instance so it will not be called during
853 	 * any future or currently ongoing emissions of the signal it has been
854 	 * connected to. The @handler_id_ptr is then set to zero, which is never a valid handler ID value (see g_signal_connect()).
855 	 *
856 	 * If the handler ID is 0 then this function does nothing.
857 	 *
858 	 * There is also a macro version of this function so that the code
859 	 * will be inlined.
860 	 *
861 	 * Params:
862 	 *     handlerIdPtr = A pointer to a handler ID (of type #gulong) of the handler to be disconnected.
863 	 *     instance_ = The instance to remove the signal handler from.
864 	 *         This pointer may be %NULL or invalid, if the handler ID is zero.
865 	 *
866 	 * Since: 2.62
867 	 */
868 	public static void clearSignalHandler(gulong* handlerIdPtr, ObjectG instance_)
869 	{
870 		g_clear_signal_handler(handlerIdPtr, (instance_ is null) ? null : instance_.getObjectGStruct());
871 	}
872 }